package com.xyy.ec.qualification.pojo;

import com.xyy.ec.qualification.enums.DBTypeEnum;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.Objects;

/**
 * @author suolong
 */
@Getter
@Setter
public class DataSourceConfig {


    private String host;
    private String port;
    private String userName;
    private String userPass;
    private String dbName;
    private String bdType;

    public String getDbTypeName(){
        if (null == this.getBdType()){
            return "";
        }
        if (Objects.equals("2", this.getBdType())){
            return DBTypeEnum.MYSQL.getDbType();
        }else if (Objects.equals("3", this.getBdType())){
            return DBTypeEnum.ORACLE.getDbType();
        }else if (Objects.equals("1", this.getBdType())){
            return DBTypeEnum.SQL_SERVER.getDbType();
        }else if (Objects.equals("4", this.getBdType())){
            return DBTypeEnum.SQL_SERVER_V2000.getDbType();
        }else if (Objects.equals("5", this.getBdType())){
            return DBTypeEnum.ORACLE_9I.getDbType();
        }
        return "";
    }
}
